//
//  PlatformManager.swift
//  ANOASTORE
//
//  Created by hudan on 2025/5/27.
//  Copyright © 2025 zwb. All rights reserved.
//

// 平台管理

import Foundation

enum PlatformType: String {
    case unkonwn = "未指定"
    case aoWang = "傲网"
    case zhuYouAn = "诸友安"
    case zhuYouAn_Old = "旧诸友安"
    case huaTong = "华统养猪平台"
    case haiXin = "海新OA"
    case fuZhiYuan = "富之源OA"
    case houQuan = "厚全OA"
    case yiZhi = "毅植"
    case yuMeiKang = "渔美康"
    case awKeShang = "傲网客商平台"
    case zyaKeShang = "诸友安客商平台"
    case zhuOKDianZiChen = "猪OK电子秤"
}

func checkPlatform(type: PlatformType) -> Bool {
    return PlatformManager.shared.platform == type
}

// 百度地图项目: 傲农OA,傲网客商,友安云,友安云客商,电子秤. 其他为高德地图项目
func isBaiduMapPlatform() -> Bool {
    let type = PlatformManager.shared.platform
    if type == .aoWang || type == .awKeShang ||
        type == .zhuYouAn || type == .zhuYouAn_Old ||
        type == .zyaKeShang || type == .zhuOKDianZiChen {
        return true
    } else {
        return false
    }
}

final class PlatformManager {
    
    private init() {}
    
    static let shared = PlatformManager()
    
    private(set) var platform: PlatformType = .unkonwn
    
    // 在 APPDelegate 中配置平台
    func applicationDidFinishLaunch(type: PlatformType) {
        platform = type
    }
}
